export default abstract class AbstractModel { 
    public id: number;

    constructor(public $obj: any) { 

        for (let key in $obj) { 
            this[key] = $obj[key];
        }
    }

    toJSON() { 
        let self = this;
        let obj: any = {};
        for (let key in self) { 
            if (/^\$/.test(key)) { 
                continue;
            }
            let val = self[key];
            if (typeof val == 'function') { 
                continue;
            }
            obj[key] = val;
        }
        return obj;
    }
}